package com.cmbdb.core.servlet;

import com.alibaba.druid.support.http.StatViewServlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 注释
 *
 * @author: coding99
 * @Date: 16-5-26
 * @Time: 上午8:39
 */
public class DruidViewServlet extends StatViewServlet {

    private String druidName,druidPassword;

    @Override
    public void init() throws ServletException {
        this.druidName = this.getInitParameter("druidName");
        this.druidPassword = this.getInitParameter("druidPassword");
        super.init();
    }

    @Override
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

      /*  if(request.getSession().getAttribute("druid") == null) {
            if(!(StringUtil.isEmpty(druidName) || StringUtil.isEmpty(druidPassword))) {
                if(druidName.equals(request.getParameter("druidName")) && druidPassword.equals(request.getParameter("druidPassword"))) {
                    request.getSession().setAttribute("druid","yes");
                    super.service(request,response);
                } else  {
                    request.setAttribute("ctx",request.getContextPath());
                    RequestDispatcher rd = request.getRequestDispatcher("druid-login.jsp");
                    rd.forward(request,response);
                }
            } else {
                response.getWriter().println("Can't find html.");
                response.getWriter().close();
            }
        } else {
            super.service(request, response);
        }*/
        super.service(request, response);
    }
}
